home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / ddutil20.arc / DDUTILS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-05-14  |  6KB  |  225 lines

  1. (***************************************************************************)
  2. (**                                                                       **)
  3. (**              DDUtils By John Richardson and Dan Vanderboom            **)
  4. (**            Copyright 1990 John Richardson and Dan Vanderboom          **)
  5. (**                                                                       **)
  6. (**                         TopSoft Support Systems                       **)
  7. (**                         2135 Possum Ct.                               **)
  8. (**                         Brookfield, Wi 53045                          **)
  9. (**                         (414)796-8408 Data 12/24                      **)
  10. (**                                                                       **)
  11. (**                                                                       **)
  12. (***************************************************************************)
  13. (**                                                                       **)
  14. (**                                                                       **)
  15. (** v1.00: Initial Release.                                               **)
  16. (** v1.10: Added 9 more new procedures/functions.                         **)
  17. (** v2.00: Rewrote into assembly                                          **)
  18. (**                                                                       **)
  19. (***************************************************************************)
  20.  
  21. Unit DDutils;
  22.  
  23. Interface
  24.  
  25. Uses Dos;
  26.  
  27. Function  DDActive:Boolean;
  28. Procedure Give_Time(Amount:Integer);
  29. Procedure Task_Off;
  30. Procedure Task_On;
  31. Function  Invisible:Boolean;
  32. Procedure Switch;
  33. Procedure Resume_Invisible;
  34. Procedure Kill_Other_Job;
  35. Procedure Suspend_Invisible;
  36. Procedure Clear_KeyBoard_Buffer;
  37. Function  Send_Char(Ch:Char):Boolean;
  38. Function  Program_Status:Integer;
  39. Function  Task_Number:Integer;
  40. Function  Other_Status:Integer;
  41. Procedure Time_Sharing(Num:Integer);
  42. Function  Current_TimeShare:Integer;
  43.  
  44. {=========================================================================}
  45.  
  46. Implementation
  47.  
  48. {=========================================================================}
  49.  
  50. Function DDActive:Boolean; Assembler;
  51. ASM
  52.    MOV AX,0E400H
  53.    INT 21H
  54.    CMP AL,00H
  55.    JE  @not_active
  56.    MOV AL,01H
  57. @not_active:
  58. End;
  59.  
  60. {=========================================================================}
  61.  
  62. Procedure Give_Time(Amount:Integer); Assembler;
  63. ASM
  64.    MOV AH,0EEH
  65.    MOV AL,BYTE PTR Amount
  66.    INT 21H
  67. End;
  68.  
  69. {=========================================================================}
  70.  
  71. Procedure Task_Off; Assembler;
  72. ASM
  73.    MOV AH,0EAH
  74.    INT 21H
  75. End;
  76.  
  77. {=========================================================================}
  78.  
  79. Procedure Task_On; Assembler;
  80. ASM
  81.    MOV AH,0EBH
  82.    INT 21H
  83. End;
  84.  
  85. {=========================================================================}
  86.  
  87. Function Invisible:Boolean; Assembler;
  88. ASM
  89.    MOV AX,0E400H
  90.    INT 21H
  91.    MOV BL,AL
  92.    XOR AL,AL  { zero register }
  93.    CMP BL,02H
  94.    JNE @no_invis
  95.    MOV AL,01H
  96.    JMP @done
  97. @no_invis:
  98.    MOV AL,00H
  99. @done:
  100. End;
  101.  
  102. {=========================================================================}
  103.  
  104. Procedure Switch; Assembler;
  105. ASM
  106.    MOV AH,0E0H
  107.    MOV AL,1
  108.    INT 21H
  109. End;
  110.  
  111. {=========================================================================}
  112.  
  113. Procedure Resume_Invisible; Assembler;
  114. ASM
  115.    MOV AH,0E0H
  116.    MOV AL,73H
  117.    INT 21H
  118. End;
  119.  
  120. {=========================================================================}
  121.  
  122. Procedure Kill_Other_Job; Assembler;
  123. ASM
  124.    MOV AH,0E0H
  125.    MOV AL,074H
  126.    INT 21H
  127. End;
  128.  
  129. {=========================================================================}
  130.  
  131. Procedure Suspend_Invisible; Assembler;
  132. ASM
  133.    MOV AH,0E0H
  134.    MOV AL,075H
  135.    INT 21H
  136. End;
  137.  
  138. {=========================================================================}
  139.  
  140. Procedure Clear_Keyboard_Buffer; Assembler;
  141. ASM
  142.    MOV AH,0E1H
  143.    INT 21H
  144. End;
  145.  
  146. {=========================================================================}
  147.  
  148. Function Send_Char(Ch:Char):Boolean; Assembler;
  149. ASM
  150.    MOV AH,0E2H
  151.    MOV DL,BYTE PTR CH
  152.    INT 21H
  153.    CMP AL,0
  154.    JNE @1
  155.    MOV AL,01H
  156. @1:
  157. End;
  158.  
  159. {=========================================================================}
  160.  
  161. Function Program_Status:Integer; Assembler;
  162. ASM
  163.    MOV AH,0E4H
  164.    INT 21H
  165.    {Program_Status := Regs.al;}
  166.    { al = 1 program is visible }
  167.    { al = 1 program is invisibile }
  168.    { al = any other value means DoubleDOS not running }
  169.    { ah = task number (0=top, 1=bottom job) }
  170. End;
  171.  
  172. {=========================================================================}
  173.  
  174. Function Task_Number:Integer; Assembler;
  175. ASM
  176.    MOV AH,0E4H
  177.    INT 21H
  178.    {MOV AX,AH}
  179.    {Task_Number := Regs.ah;}  { 0=top, 1=bottom }
  180. End;
  181.  
  182. {=========================================================================}
  183.  
  184. Function Other_Status:Integer; Assembler;
  185. ASM
  186.    MOV AH,0E5H
  187.    INT 21H
  188.    {MOV AX,AL}
  189.    {Other_Status := Regs.al;}
  190.    { al = 0 no program running   }
  191.    { al = 1 program is running   }
  192.    { al = 2 program is suspended }
  193. End;
  194.  
  195. {=========================================================================}
  196.  
  197. Procedure Time_Sharing(Num:Integer); Assembler;
  198. ASM
  199.    { Num Variable }
  200.    { 0 = visible program gets 70% invisible gets 30% (default) }
  201.    { 1 = visible program gets 50% invisible gets 50% of time }
  202.    { 2 = visible program gets 30% invisible gets 70% of time }
  203.    { 3 = top program gets 70% bottom program gets 30% of time }
  204.    { 4 = top program gets 30% bottom program gets 70% of time }
  205.    { 5 = returns current priotity setting in al }
  206.    MOV AH,0E9H
  207.    MOV AL,BYTE PTR Num
  208.    INT 21H
  209. End;
  210.  
  211. {=========================================================================}
  212.  
  213. Function Current_TimeShare:Integer; Assembler;
  214. ASM
  215.    MOV AH,0E9H
  216.    MOV AL,5
  217.    INT 21H
  218.    {MOV AX,AL}
  219.    {Current_TimeShare := Regs.al;}
  220. End;
  221.  
  222. {=========================================================================}
  223.  
  224. End.
  225.